# -*- coding: utf-8 -*-

"""
DateTime   : 2021/04/06 18:01
Author     : ZhangYafei
Description: 
"""
from urllib.parse import urljoin

from lxml import etree

import requests


url = 'https://pic.netbian.com'

response = requests.get(url)
html = etree.HTML(response.content)

for li in html.xpath('//*[@id="main"]/div[3]/ul/li'):
    href = li.xpath('a/@href')[0]
    uid = href.rsplit('/', maxsplit=1)[1].replace('.html', '')
    title = li.xpath('a//img/@alt')[0].replace(' ', '_')
    response = requests.get(urljoin(url, href))
    html = etree.HTML(response.content)
    img_url = urljoin(url, html.xpath('//a[@id="img"]/img/@src')[0])
    print(uid, title, img_url)